<template>
	<view>
		<view class="themeList" v-for="item in chefList" :key="item.id">
			<view class="item" @click="goDetail(item)" style="background-color: #efefef;margin-top: 10upx;">
				<image :src="item.avatar" mode="aspectFill"></image>
				<view class="desc">
					<view class="bigText">{{item.name}}
						<text v-if="item.rating===1">（初级） </text>
						<text v-else-if="item.rating===2"> （中级） </text>
						<text v-else> （高级） </text>
					</view>
					<view class="smallText">个人介绍: {{item.specialty}}</view>
					<view class="experience">
						<view>
							工作经验:{{item.experience}}年
						</view>
						<view class="price">
							价格:{{item.price}}元/小时
						</view>


					</view>
				</view>

			</view>
		</view>
		<view class="blank"></view>
	</view>
</template>

<script>
	import {
		myRequestPost
	} from "@/utils/request.js";

	import {
		chef_list
	} from '@/api/chef.js'

	export default {
		data() {
			return {
				themeList: [{
						"imageUrl": "https://i2.chuimg.com/b17dad3a2235491e830935881451595e_2560w_2560h.jpg?imageView2/2/w/620/interlace/1/q/75",
						"name": "张厨师",
						"subName": "高级厨师"
					},
					{
						"imageUrl": "https://i2.chuimg.com/b17dad3a2235491e830935881451595e_2560w_2560h.jpg?imageView2/2/w/620/interlace/1/q/75",
						"name": "经典川菜回锅肉",
						"subName": "经典川菜回锅肉"
					},
					{
						"imageUrl": "https://i2.chuimg.com/b17dad3a2235491e830935881451595e_2560w_2560h.jpg?imageView2/2/w/620/interlace/1/q/75",
						"name": "经典川菜回锅肉",
						"subName": "经典川菜回锅肉"
					}

				],
				chefList: [],
				themeDescription: []
			};
		},
		onLoad() {
			this.getChefList();
		},
		onShow() {
			this.getChefList();
		},
		methods: {
			getChefList() {
				let params = {}
				params.status = 2
				chef_list(params).then(res => {
					this.chefList = res.data
				})
			},
			async getThemes() {
				let result = await myRequestPost("/rest/cks/api/theme/list/get");
				this.themeList = result.items;
				this.themeDescription = result.description;
			},
			goDetail(item) {
				uni.navigateTo({
					url: '/pages/chefDetail/chefDetail?id=' + item.id
				})
			}
		}
	}
</script>

<style lang="less">
	

	.blank {
		width: 750rpx;
		height: 400rpx;
	}

	.item {
		// width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;

		image {
			margin-left: 24upx;
			margin-top: 24upx;
			width: 260upx;
			height: 200upx;
			border-radius: 30upx;
		}

		.desc {
			width: 100%;
			margin-left: 24upx;
		}
	}

	.bigText {
		font-size: 36upx;
		font-weight: bold;
		font-family: "宋体";
	}

	.smallText {
		margin-top: 15upx;
		color: black;
		font-size: 28upx;
	}

	.experience {
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin-top: 10upx;
		color: gray;
		font-size: 24upx;
	}
	.price{
		margin-right: 24upx;
	}
</style>